package com.lh.eemsserver.Controller;

import com.lh.eemsserver.Service.DirectorService;
import com.lh.eemsserver.po.Procedure;
import com.lh.eemsserver.po.Report;
import com.lh.eemsserver.po.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Director")
public class DirectorController {
    @Autowired
    private DirectorService directorService;

    @RequestMapping("/listAllReport")
    public List<Report> listAllReport() {
        return directorService.listAllReport();
    }
    //该函数是列举所有待审批的report

    @RequestMapping("/listAllReportExceptApprovalPending")
    public List<Report> listAllReportExceptApprovalPending(){
        return directorService.listAllReportExceptApprovalPending();
    }
    @RequestMapping("/getProcedure")
    public List<Procedure> getProcedure(@RequestBody Report report) {
        return directorService.getProcedure(report);
    }

    @RequestMapping("/getReportById")
    public Report getReportById(@RequestBody Report report){
        return directorService.getReportById(report);
    }

    @RequestMapping("/getProcedureNum")
    public int getProcedureNum(@RequestBody Report report){
        return directorService.getProcedureNum(report);
    }
    @RequestMapping("/setUpdaterInfo")
    public int setUpdaterInfo(@RequestBody Report report) {
        return directorService.setUpdaterInfo(report);
    }

    @RequestMapping("/getUserName")
    public User getUserName(@RequestBody User user) {
        return directorService.getUserName(user);
    }

    @RequestMapping("/getUserInfo")
    public User getUserInfo(@RequestBody User user) {
        return directorService.getUserInfo(user);
    }

    @RequestMapping("renewUserInfo")
    public int renewUserInfo(@RequestBody User user){
        return directorService.renewUserInfo(user);
    }
    @RequestMapping("/getReportNum")
    public int getReportNum(){
        return directorService.getReportNum();
    }

    @RequestMapping("/renewreportState")
    public int renewreportState(@RequestBody Report report){
        return directorService.renewreportState(report);
    }
}
